]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Remove old compatibility code
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 13 Aug 2020 21:35:27 +0000 (23:35 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 13 Aug 2020 23:00:21 +0000 (23:00 +0000)
Since gjs moved to mozjs60, return values of int8_t arrays can
no longer be treated as strings. We originally made the conversion
conditional to keep working with the (then) stable gjs release.

That was two years ago and we require a more recent gjs nowadays,
so there's no good reason for keeping the old code path.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1407

js/ui/components/networkAgent.js
js/ui/extensionSystem.js
js/ui/keyboard.js
js/ui/padOsd.js
js/ui/sessionMode.js

index 1033a6de39e4c3ee4e58237710c06e3caaf5c8a7..32ec1da8522658f24c40ebe0aedf11b2a7466146 100644 (file)
@@ -2,6 +2,7 @@
 /* exported Component */
 
 const { Clutter, Gio, GLib, GObject, NM, Pango, Shell, St } = imports.gi;
+const ByteArray = imports.byteArray;
 const Signals = imports.signals;
 
 const Dialog = imports.ui.dialog;
@@ -522,13 +523,7 @@ var VPNRequestHandler = class {
         let contentOverride;
 
         try {
-            data = this._dataStdout.peek_buffer();
-
-            if (data instanceof Uint8Array)
-                data = imports.byteArray.toGBytes(data);
-            else
-                data = data.toGBytes();
-
+            data = ByteArray.toGBytes(this._dataStdout.peek_buffer());
             keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE);
 
             if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2)
index f0b8361714efe248d118322f2f4a7a25a62d4cfe..41ef98d70ec302aaf02e8866eb8a41fbc400fd45 100644 (file)
@@ -2,6 +2,7 @@
 /* exported init connect disconnect */
 
 const { GLib, Gio, GObject, Shell, St } = imports.gi;
+const ByteArray = imports.byteArray;
 const Signals = imports.signals;
 
 const ExtensionDownloader = imports.ui.extensionDownloader;
@@ -282,8 +283,7 @@ var ExtensionManager = class {
         let metadataContents, success_;
         try {
             [success_, metadataContents] = metadataFile.load_contents(null);
-            if (metadataContents instanceof Uint8Array)
-                metadataContents = imports.byteArray.toString(metadataContents);
+            metadataContents = ByteArray.toString(metadataContents);
         } catch (e) {
             throw new Error('Failed to load metadata.json: %s'.format(e.toString()));
         }
index 90bd17b86f6f1831b9c80490d6682d1d1df58d2b..a579495ad66f61cd1006d1305eccf1565edc53e8 100644 (file)
@@ -2,6 +2,7 @@
 /* exported KeyboardManager */
 
 const { Clutter, Gio, GLib, GObject, Meta, St } = imports.gi;
+const ByteArray = imports.byteArray;
 const Signals = imports.signals;
 
 const InputSourceManager = imports.ui.status.keyboard;
@@ -532,8 +533,7 @@ var KeyboardModel = class {
     _loadModel(groupName) {
         let file = Gio.File.new_for_uri('resource:///org/gnome/shell/osk-layouts/%s.json'.format(groupName));
         let [success_, contents] = file.load_contents(null);
-        if (contents instanceof Uint8Array)
-            contents = imports.byteArray.toString(contents);
+        contents = ByteArray.toString(contents);
 
         return JSON.parse(contents);
     }
index 115b72be2ed74ed824b4438ee3ae1df0e6628836..9ab1cbb9dfae9f175b02dab98669d8acc41c9650 100644 (file)
@@ -3,6 +3,7 @@
 
 const { Atk, Clutter, GDesktopEnums, Gio,
         GLib, GObject, Gtk, Meta, Pango, Rsvg, St } = imports.gi;
+const ByteArray = imports.byteArray;
 const Signals = imports.signals;
 
 const Main = imports.ui.main;
@@ -297,8 +298,7 @@ var PadDiagram = GObject.registerClass({
     _init(params) {
         let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/pad-osd.css');
         let [success_, css] = file.load_contents(null);
-        if (css instanceof Uint8Array)
-            css = imports.byteArray.toString(css);
+        css = ByteArray.toString(css);
         this._curEdited = null;
         this._prevEdited = null;
         this._css = css;
index 454804933efdd2869e8336ee617580e8fa7d9f68..2136e948f1f5a568c52102fa05fe4261dd92a8cb 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported SessionMode, listModes */
 
+const ByteArray = imports.byteArray;
 const GLib = imports.gi.GLib;
 const Signals = imports.signals;
 
@@ -105,8 +106,7 @@ function _loadMode(file, info) {
     let fileContent, success_, newMode;
     try {
         [success_, fileContent] = file.load_contents(null);
-        if (fileContent instanceof Uint8Array)
-            fileContent = imports.byteArray.toString(fileContent);
+        fileContent = ByteArray.toString(fileContent);
         newMode = JSON.parse(fileContent);
     } catch (e) {
         return;